require 'Qt4'
load 'mainform.rb'
load 'database.rb'

if $0 == __FILE__
    a = Qt::Application.new(ARGV)
    
	Qt::TextCodec::setCodecForLocale(Qt::TextCodec::codecForName("UTF-8"))
    Qt::TextCodec::setCodecForCStrings(Qt::TextCodec::codecForName("UTF-8"))
	
	db=Database.new
	db.load
	
	w = MainForm.new
	w.init(db)
    a.exec
	
	db.save
end